package cn.kgc.gl.test2;
//获取和设置主线程及子线程的优先级
public class TestThread {
	public static void main(String[] args) {
		
	
	//创建主线程
	Thread mainThread=Thread.currentThread();
	//创建子线程
	Thread myThread =new Thread(new MyThread());
	System.out.println("*******显示默认优先级*********");
	System.out.println("主线程名"+mainThread.getName()+"，优先级"+mainThread.getPriority());
	System.out.println("主线程名"+myThread.getName()+"，优先级"+myThread.getPriority());
	
	System.out.println("*******修改优先级之后*********");
	mainThread.setPriority(Thread.MAX_PRIORITY);
	myThread.setPriority(Thread.MIN_PRIORITY);
	System.out.println("主线程名"+mainThread.getName()+"，优先级"+mainThread.getPriority());
	System.out.println("主线程名"+myThread.getName()+"，优先级"+myThread.getPriority());
	
	}
}
